<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>javascript</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box
    }
    body {
      font-size: 14px;
      padding: 20px;
    }
    ul li {
      line-height: 30px;
    }
  </style>
</head>
<body>
  <ul>
    <li></li>
  </ul>
</body>
<script>
  var name = 'hello'
  function foo(a,b) {
    return a+b
  }
  function foo1(a,b){
    return a-b
  }
  var obj = {
    name: 'hi',
    foo: foo
  }
  var obj1 = {
    name: 'bye'
  }
  foo(); // hello
  console.log(foo.call(foo1, 2,3));
  function Person(name, age, sex) {
    this.name = name;
    this.age = age;
    this.sex = sex;
    this.getName = function() {
      return this.name
    }
  }
  var person = new Person('tony', '30', '男')
  console.log(person.name) // tony
  console.log(person.getName()) // tony
  var say = 'hi'
  function test() {
    console.log(this.say)
  }
  var obj3 = {
    say: 'hello',
    test: test
  }
  obj3.test() // hello
</script>
</html>